package com.atguigu.gmall.juc.atomic;

import java.util.concurrent.CountDownLatch;

/**
 * @author 陈昆昆
 * @version 1.0
 * @date 2020/6/2 17:47
 */
public class CountDownLatchTest {
    public static void main(String[] args) throws InterruptedException {
        CountDownLatch countDownLatch = new CountDownLatch(6);
        for (int i = 1; i <= 6; i++) {
            new Thread(()->{
                System.out.println(Thread.currentThread().getName()+"--->"+"离开");
                countDownLatch.countDown();
            },Code.index(i).getMessage()).start();
        }
        countDownLatch.await();
        System.out.println(Thread.currentThread().getName()+"关门");
    }
}
